import React, { Component } from 'react';
import { Router, Route, Switch, Redirect } from 'react-router-dom';
import sdk from '@knx-micro/sdk';
import loadable from '@loadable/component';
import NotFound from '@pages/NotFound';

const Index = loadable(() => import('@pages/Index')),
  Kanban = loadable(() => import('@pages/Kanban')),
  Recruit = loadable(() => import('@pages/Recruit'));

class App extends Component {
  render() {
    return (
      <Router history={sdk.history}>
        <Switch>
          <Route path="/" exact component={Index}/>
          <Route path="/kanban" component={Kanban}/>
          <Route path="/recruit" component={Recruit}/>
          <Route path="/404" component={NotFound}/>
          <Redirect to="/404"/>
        </Switch>
      </Router>
    );
  }
}

export default App;
